package com.fesine.ch01.lesson03;

/**
 * 测试MyRunnable类
 * Created by Fesine on 2016/6/26.
 */
public class TestMyRunnable {
    public static void main(String[] args) {
        //创建MyRunnable对象
        Runnable runnable = new MyRunnable();
        //创建线程，并传入runnable对象
        Thread thread = new Thread(runnable);
        Thread t1 = new Thread(thread);
        //Thread t1 = new Thread(runnable);
        //启动线程
        thread.start();
        System.out.println("运行结束");
        //因为Thread也实现了Runnable接口，所以也可以将thread作为参数传到新的线程中

        //try {
        //    Thread.sleep(200);
        //} catch (InterruptedException e) {
        //    e.printStackTrace();
        //}
        t1.start();
    }
}
